﻿using Sundstrom.Mvvm.Messaging;

namespace Sundstrom.Mvvm.Tests.ViewModels
{
    public sealed class ViewModel1 : ViewModelBase
    {
        private string _sampleProperty;
        private string _sampleProperty2;

        public ViewModel1()
        {
            MessageBus = MessageBus.Default;

            SampleProperty = "Hello World!";
        }

        private MessageBus MessageBus { get; set; }

        public string SampleProperty
        {
            get { return _sampleProperty; }
            set
            {
                _sampleProperty = value;
                RaisePropertyChanged();
            }
        }

        public string SampleProperty2
        {
            get { return _sampleProperty2; }
            set
            {
                _sampleProperty2 = value;
                MessageBus.Send(new TextMessage(value));
                RaisePropertyChanged();
            }
        }
    }
}